public class Score {
    private Student student;    // 关联学生
    private Course course;      // 关联课程
    private double score;       // 分数（0-100）

    public Score(Student student, Course course, double score) throws ScoreException {
        this.student = student;
        this.course = course;
        setScore(score); // 校验分数范围
    }

    // 分数校验（0-100）
    public void setScore(double score) throws ScoreException {
        if (score < 0 || score > 100) {
            throw new ScoreException("分数必须在0-100之间，当前为：" + score);
        }
        this.score = score;
    }

    // Getter方法（仅查询，不允许直接修改）
    public Student getStudent() { return student; }
    public Course getCourse() { return course; }
    public double getScore() { return score; }
}